package cn.guo.service.impl;


import java.util.List;

import cn.guo.dao.INewsDao;
import cn.guo.entity.News;
import cn.guo.service.INewsService;


public class NewsService implements INewsService {
	
	// 容器注入
	private INewsDao  newsDao;
	
	public void setNewsDao(INewsDao newsDao) {
		this.newsDao = newsDao;
	}

	public void delete(int id) {
		newsDao.delete(id);
	}

	public void deleteMany(int[] ids) {
		if (ids != null && ids.length >0) {
			for (int id : ids){
				delete(id);
			}
		}
	}

	public News findById(int id) {
		return newsDao.findById(id);
	}

	public List<News> getAll() {
		return newsDao.getAll();
	}

	public List<News> getAll(String ntitle) {
		return newsDao.getAll(ntitle);
	}

	public void save(News news) {
		newsDao.save(news);
	}

	public void update(News news) {
		newsDao.update(news);
	}

}